#define _CRT_SECURE_NO_WARNINGS 1
#include<map>
using namespace std;
class Solution {
public:
    int singleNumber(vector<int>& nums) {
        map<int, int> dict;
        for (int i = 0; i < nums.size(); i++)
        {
            int key = nums[i];
            dict[key]++;
        }
        map<int, int>::iterator it = dict.begin();
        while (it != dict.end())
        {
            if (it->second == 1) break;
            ++it;
        }
        return it->first;
    }
};